package NGUYENVIETANH.ARAY_EXCERCISE;

public class EX02 {
	public static int average(int[] mylist) {
		double KQ = 0;
		int sum = 0;
		for (int i = 0; i < mylist.length; i++) {
			sum += mylist[i];
			System.out.println("ARRAY1[" + i + "] :" + mylist[i]);
		}
		KQ = (double) sum / mylist.length;
		System.out.println("\nAverage Array 1:   " + KQ);
		System.out.println("");
		System.out.println("");
		return 0;
	}

	public static double average(double[] mylist) {
		double KQ = 0;
		double sum = 0;
		for (int i = 0; i < mylist.length; i++) {
			sum += mylist[i];
			System.out.println("ARRAY2[" + i + "] :" + mylist[i]);
		}
		KQ = sum / mylist.length;
		System.out.println("\nAverage Array 2:   " + KQ);
		return KQ;
	}

	public static void main(String[] args) {
		average(new int[] { 1, 2, 3, 4, 5, 6 });
		average(new double[] { 6.0, 4.4, 1.9, 2.9, 3.4, 3.5 });
	}

}